﻿@using DevelopmentKit.Cms.Domain
@using DevelopmentKit.Cms.Helper
@using DevelopmentKit.Extensions.MvcContrib
@model DevelopmentKit.Web.Controllers.ViewModels.ContentViewModels.CreateContentViewModel

@{
    var definition = ViewBag.Definition as Definition;
    var viewTemplates = ViewBag.Templates as List<SelectListItem>;
    ViewBag.Title = "新建" + definition.Name;
    Layout = "~/Views/Shared/_EmtypeLayout.cshtml";
}
<div class="tips"  >
    
    <strong>新建: @definition.Name </strong>    
</div>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    @Html.AntiForgeryToken()
    @Html.HiddenFor(model => model.Parent)
    @Html.HiddenFor(model => model.Definition)
    <fieldset>
        <legend>基本信息</legend>
        <ul class="list_form">
            <li>
                @Html.LabelFor(model => model.Title)   
                @Html.TextBoxFor(model => model.Title, new {@class = "text-long"}) 
                @Html.ValidationMessageFor(model => model.Title)
            </li>
            <li>
                @Html.LabelFor(model => model.Name)   
                @Html.TextBoxFor(model => model.Name, new {@class = "text-long"}) 
                @Html.ValidationMessageFor(model => model.Name)
            </li>
            @if (null != viewTemplates && viewTemplates.Any())
            {
                <li>
                    @Html.LabelFor(model => model.Template)       
                    @Html.DropDownListFor(model => model.Template, viewTemplates, new {@class = "text-long"})   
                    @Html.ValidationMessageFor(model => model.Template)
                </li>

            } 
        </ul>
    </fieldset>
    if (definition.Propertys.Any())
    {
        <fieldset>
            <legend>扩展信息</legend>
            <ul class="list_form">
                @foreach (var property in definition.Propertys)
                {
                    <li>
                        @Html.Label(property.Display)   
                        @Html.Edit(property, property.DefaultValue)
                    </li>
                }
            </ul>
        </fieldset>
    }
    <input type="submit" name="command" class="button-submit" value="保存为草稿" />
    <input type="submit" name="command"  class="button-submit" value="立刻发布" />
    <input type="submit" name="command"  class="button-submit" value="预览" />
}

